package com.spzx.user.service.impl;

import com.spzx.model.entity.user.UserAddress;
import com.spzx.user.mapper.UserAddressMapper;
import com.spzx.user.service.UserAddressService;
import com.spzx.utils.AuthContextUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Project: spzx-parent
 * Package: com.spzx.user.service.impl
 * Version: 1.0
 * <p>
 * Created by  wangjiaxin  on 2024/4/27 下午11:38
 */
@Service
public class UserAddressServiceImpl implements UserAddressService {
    @Autowired
    private UserAddressMapper userAddressMapper;

    /**
     * 获取用户地址列表
     *
     * @return
     */
    @Override
    public List<UserAddress> findUserAddressList() {
        Long userId = AuthContextUtil.getUserInfo().getId();
        return userAddressMapper.findByUserId(userId);
    }

    /**
     * 获取地址信息
     *
     * @param id
     * @return
     */
    @Override
    public UserAddress getById(Long id) {
        return userAddressMapper.getById(id);
    }
}
